package top.v5it.japi.ddd.example.order.proxy.impl;

import lombok.extern.slf4j.Slf4j;
import top.v5it.japi.ddd.example.domain.proxy.ProductVO;
import top.v5it.japi.ddd.example.order.proxy.ProductService;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhanpu
 * @date 2023/11/16
 */
@Slf4j
public class ProductServiceImpl implements ProductService {

    @Override
    public ProductVO getProduct(Long id) {
        log.warn("call searchById fallback");
        return new ProductVO();
    }

    @Override
    public List<ProductVO> getProducts(Map<String, List<Long>> ids) {
        log.warn("call searchByIds fallback");
        final List<Long> list = ids.get("ids");
        return list.stream().map(t -> {
            final ProductVO productVO = new ProductVO();
            productVO.setId(t);
            return productVO;
        }).collect(Collectors.toList());
    }
}
